package com.gvfish.web.jsf;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import com.google.appengine.api.datastore.Text;

public class GTextConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
		System.out.println("in converter"+value);
		Text text = new Text(value);
		return text;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		String result="";
		if (arg2 instanceof Text) {
			Text text = (Text) arg2;
			result = text.getValue();
		}
		return result;
	}

}
